//
//  XTXAlbumOrVideoCell.m
//  xiaotianxin
//
//  Created by XYC on 2019/6/25.
//  Copyright © 2019 XYC. All rights reserved.
//

#import "XTXAlbumOrVideoCell.h"

@implementation XTXAlbumOrVideoCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.pictureImageView];
        [self addSubview:self.deleteBtn];
    }
    return self;
}

- (UIImageView *)pictureImageView{
    if (!_pictureImageView) {
        self.pictureImageView = [[UIImageView alloc] initWithFrame:self.bounds];
        [_pictureImageView setContentScaleFactor:[[UIScreen mainScreen] scale]];
        _pictureImageView.contentMode =  UIViewContentModeScaleAspectFill;
        _pictureImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
        _pictureImageView.clipsToBounds  = YES;
        _pictureImageView.layer.cornerRadius = 5;
        _pictureImageView.layer.masksToBounds = YES;
    }
    return _pictureImageView;
}
- (UIButton *)deleteBtn{
    if (!_deleteBtn) {
        self.deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _deleteBtn.frame = CGRectMake(CGRectGetWidth(self.bounds)-30, 7, 20, 20);
        _deleteBtn.userInteractionEnabled=NO;
        [_deleteBtn setBackgroundImage:[UIImage imageNamed:@"未勾选图片或视频"] forState:UIControlStateNormal];
        [_deleteBtn setBackgroundImage:[UIImage imageNamed:@"勾选图片或视频"] forState:UIControlStateSelected];
        _deleteBtn .imageView .transform  = CGAffineTransformMakeRotation(M_PI);
    }
    return _deleteBtn;
}

@end
